# 方法1
a = "afaijfoaaef3289"
print(len(a))
for i in a:
    try:
        print(int(i))
    except ValueError:
        print("这个是字符")

# 方法2
string = input("请输入字符串：")

char = 0
number = 0
space = 0
other = 0

for i in string:
    if i.isalpha():
        char += 1
    elif i.isalnum():
        number += 1
    elif i.isspace():
        space += 1
    else:
        other += 1

print(f"字符串有{char}个，数字有{number}个，空格有{space}个，其他符号有{other}个。")

